package com.docking.heylo;

import net.sf.ehcache.CacheManager;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@SpringBootApplication
@EnableCaching
@MapperScan("com.docking.heylo.dao.mapper")
@ComponentScan(basePackages = {"com.docking.heylo"})
@EnableTransactionManagement
@EnableScheduling
public class PublicApiApplication {

    public static void main(String[] args) {
        SpringApplication.run(PublicApiApplication.class, args);
    }

    @PostConstruct
    private void init(){
        System.setProperty(CacheManager.ENABLE_SHUTDOWN_HOOK_PROPERTY,"true");
    }

    @PreDestroy
    private void destroy(){
        CacheManager.getInstance().shutdown();
    }








}
